﻿using System;

namespace UniRx.Operators
{
	// Token: 0x02000287 RID: 647
	internal class DelaySubscriptionObservable<T> : OperatorObservableBase<T>
	{
		// Token: 0x06000E78 RID: 3704 RVA: 0x0004429C File Offset: 0x0004269C
		public DelaySubscriptionObservable(IObservable<T> source, TimeSpan dueTime, IScheduler scheduler) : base(scheduler == Scheduler.CurrentThread || source.IsRequiredSubscribeOnCurrentThread<T>())
		{
			this.source = source;
			this.scheduler = scheduler;
			this.dueTimeT = new TimeSpan?(dueTime);
		}

		// Token: 0x06000E79 RID: 3705 RVA: 0x000442D2 File Offset: 0x000426D2
		public DelaySubscriptionObservable(IObservable<T> source, DateTimeOffset dueTime, IScheduler scheduler) : base(scheduler == Scheduler.CurrentThread || source.IsRequiredSubscribeOnCurrentThread<T>())
		{
			this.source = source;
			this.scheduler = scheduler;
			this.dueTimeD = new DateTimeOffset?(dueTime);
		}

		// Token: 0x06000E7A RID: 3706 RVA: 0x00044308 File Offset: 0x00042708
		protected override IDisposable SubscribeCore(IObserver<T> observer, IDisposable cancel)
		{
			//DelaySubscriptionObservable<T>.<SubscribeCore>c__AnonStorey0 <SubscribeCore>c__AnonStorey = new DelaySubscriptionObservable<T>.<SubscribeCore>c__AnonStorey0();
			//<SubscribeCore>c__AnonStorey.observer = observer;
			//<SubscribeCore>c__AnonStorey.$this = this;
			//MultipleAssignmentDisposable d;
			//if (this.dueTimeT != null)
			//{
			//	MultipleAssignmentDisposable d = new MultipleAssignmentDisposable();
			//	TimeSpan dueTime = Scheduler.Normalize(this.dueTimeT.Value);
			//	d.Disposable = this.scheduler.Schedule(dueTime, delegate()
			//	{
			//		d.Disposable = <SubscribeCore>c__AnonStorey.$this.source.Subscribe(<SubscribeCore>c__AnonStorey.observer);
			//	});
			//	return d;
			//}
			//d = new MultipleAssignmentDisposable();
			//d.Disposable = this.scheduler.Schedule(this.dueTimeD.Value, delegate()
			//{
			//	d.Disposable = <SubscribeCore>c__AnonStorey.$this.source.Subscribe(<SubscribeCore>c__AnonStorey.observer);
			//});
			//return d;
			return null;
		}

		// Token: 0x04000862 RID: 2146
		private readonly IObservable<T> source;

		// Token: 0x04000863 RID: 2147
		private readonly IScheduler scheduler;

		// Token: 0x04000864 RID: 2148
		private readonly TimeSpan? dueTimeT;

		// Token: 0x04000865 RID: 2149
		private readonly DateTimeOffset? dueTimeD;
	}
}
